#ifndef _TAGFS_TAGTREE_H_
#define _TAGFS_TAGTREE_H_

#include <list>
#include <stack>
#include <string>
#include <map>
#include "tagfs_file.h"
#include "tagfs_map.h"

class TagFS_TagTree
{
	public:
		enum Mode
		{
			MODE_AND,
			MODE_OR
		};
		
		bool parse(std::list<std::string> query);
		std::list<uint64_t> compute(TagFS_Map*);

	private:
		enum Node
		{
			NODE_TAG,
			NODE_TREE
		};

		Mode mode;
		std::stack<Node> nodeOrder;
		std::list<std::string> tags;
		std::list<TagFS_TagTree> trees;

		void push(std::string newNode, Mode newMode = MODE_AND);
		void push(TagFS_TagTree newNode, Mode newMode = MODE_AND);
		bool pop();
};

#endif
